def findMax(matrix): # DO NOT modify this line 
    max=matrix[0][0]
    indexes=[]
    for i in range(len(matrix)):
        for j in range (len(matrix[i])):
            if matrix[i][j]>max:
                max=matrix[i][j]
    for i in range(len(matrix)):
        for j in range(len(matrix[i])):
            if matrix[i][j]==max:
                indexes.append((i,j))
    return max,indexes
def main():
    n = eval(input())
    matrix = []
    for i in range(n):
        row = [ eval(x) for x in input().split() ]
        matrix.append(row)
    max_value, max_indexes = findMax(matrix)
    print(max_value)
    for item in max_indexes:
        print(item[0],item[1],sep=',')
    
if __name__ == "__main__":
    main()